<template>
	<view class="class flex">
		<view class="item1" :class="cur==0?'active':''" @click="currents(0)">
			{{name1}}
		</view>
		<view class="item2" :class="cur==1?'active':''" @click="currents(1)">
			{{name2}}
		</view>
	</view>
</template>

<script>
	export default {
		name: "switch",
		props: {
			name1: String,
			name2: String,
			cur: Number
		},
		data() {
			return {
				
			}
		},
		methods:{
			//点击事件
			currents(id){
				this.$emit("curren", id)
			}
		}
	}
</script>

<style lang="scss">
	.class {
		padding: 30rpx 30rpx 20rpx;

		.item1 {
			font-size: 28rpx;
			color: #666666;
		}

		.item2 {
			margin-left: 30rpx;
			font-size: 28rpx;
			color: #666666;
		}

		.active {
			font-weight: bold;
			color: #0265EB;
		}
	}
</style>
